package com.chenfan.mcn.model;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chenfan.common.extension.validation.groups.Add;
import com.chenfan.common.extension.validation.groups.Modify;
import com.chenfan.mcn.model.base.BaseOwnerEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * <p>
 * 折扣审批单
 * </p>
 *
 * @author lizhejin
 * @since 2021-01-07
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("discount_approval")
public class DiscountApproval extends BaseOwnerEntity {

    private static final long serialVersionUID = -7949599050938348582L;

    /**
     * 审批单编号
     */
    @Excel(name = "审批单号")
    private String discountCode;

    /**
     * 优惠类型:0_单笔优惠，1_年度优惠
     */
    @NotNull(message = "优惠类型不能为空", groups = {Add.class, Modify.class})
    private Integer approvalType;

    /**
     * 客户id
     */
    @NotNull(message = "客户信息不能为空", groups = {Add.class, Modify.class})
    private Long customerId;

    /**
     * 审批状态:0_待提交, 1_审批中, 2_审批通过, 3_审批拒绝, 4_已撤回
     */
    private Integer approvalStatus;

    /**
     * 合同主体(数据字典)
     */
    @NotBlank(message = "合同主体不能为空", groups = {Add.class, Modify.class})
    private String contractSubject;

    /**
     * 是否签订年框合同
     */
    @NotNull(message = "是否签订年框合同不能为空", groups = {Add.class, Modify.class})
    @Excel(name = "是否签订年框合同", orderNum = "6", replace = {"否_false", "是_true", "_null"})
    private Boolean yearDiscountStatus;

    /**
     * 合同金额(单笔优惠时必填)
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal contractAmount;

    /**
     * 时效开始时间
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String startDate;

    /**
     * 失效结束时间
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String endDate;

    /**
     * 申请描述
     */
    @Excel(name = "申请理由", orderNum = "9")
    @NotBlank(message = "申请描述", groups = {Add.class, Modify.class})
    private String description;

    /**
     * 备注
     */
    @Excel(name = "备注", orderNum = "12")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String remark;

    /**
     * 返点类型(单笔优惠时必填)(数据字典)
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String rebateType;

    /**
     * 返点比例(单笔优惠时必填)
     */
    @Excel(name = "返点比例", orderNum = "17", numFormat = "#.##", suffix = "%")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal rebateRate;

    /**
     * 折扣比例(单笔优惠时必填)
     */
    @Excel(name = "折扣比例", orderNum = "18", numFormat = "#.##", suffix = "折")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal discountRate;

    /**
     * 优惠形式:0_仅频台返点,1_年度优惠含平台返点,2_年度优惠不含平台返点,3_仅年度优惠
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Integer discountType;

    /**
     * 是否含直播全案
     */
    @Excel(name = "是否直播全案", orderNum = "16", replace = {"否_false", "是_true", "_null"})
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Boolean liveBroadcastStatus;

    /**
     * 附件
     */
    private String enclosure;

    /**
     * 我司签约主体id
     */
    @NotNull(message = "我司签约主体id不能为空", groups = {Add.class, Modify.class})
    private Long contractingId;

}
